//
//  ZHShowHUD.h
//  ZH_Helper
//
//  Created by caixiang on 2017/10/19.
//  Copyright © 2017年 蔡翔. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "MBProgressHUD.h"

typedef NS_ENUM(NSInteger, ZHMBProgressHUDAnimation) {
    /// Opacity animation
    ZHMBProgressHUDAnimationFade,
    /// Opacity + scale animation (zoom in when appearing zoom out when disappearing)
    ZHMBProgressHUDAnimationZoom,
    /// Opacity + scale animation (zoom out style)
    ZHMBProgressHUDAnimationZoomOut,
    /// Opacity + scale animation (zoom in style)
    ZHMBProgressHUDAnimationZoomIn
};

@interface ZHShowHUD : NSObject

@property (copy, nonatomic) void(^configShowHUDBlock)(ZHShowHUD *config);
@property (copy, nonatomic) UIView *(^configShowHUDCustomViewBlock)(void);
@property (nonatomic, assign) ZHMBProgressHUDAnimation animationStyle;  // 动画样式
// 文本加菊花
@property (nonatomic, strong) NSString *text;
// 文本字体
@property (nonatomic, strong) UIFont *textFont;
// 自定义view  37x37尺寸
@property (nonatomic, strong) UIView *customView;
// 只显示文本
@property (nonatomic, assign) BOOL showTextOnly;
// 边缘留白
@property (nonatomic, assign) CGFloat  margin;
// 背景颜色(设置了颜色之后,透明度就会失效)
@property (nonatomic, strong) UIColor *backgroundColor;
// 文本颜色
@property (nonatomic, strong) UIColor *labelColor;
// 透明度
@property (nonatomic, assign) CGFloat opacity;
// 圆角
@property (nonatomic, assign) CGFloat cornerRadius;

// 仅仅显示文本并持续几秒的方法
/* - 使用示例 -
 [ShowHUD showTextOnly:@"请稍后,显示不了..."
 configParameter:^(ShowHUD *config) {
 config.margin          = 10.f;    // 边缘留白
 config.opacity         = 0.7f;    // 设定透明度
 config.cornerRadius    = 2.f;     // 设定圆角
 } duration:3 inView:self.view];
 */
+ (void)showTextOnly:(NSString *)text
     configParameter:(void(^)(ZHShowHUD *config))configShowHUDBlock
            duration:(NSTimeInterval)sec
              inView:(UIView *)view;
// 显示文本与菊花并持续几秒的方法(文本为nil时只显示菊花)
/* - 使用示例 -
 [ShowHUD showText:@"请稍后,显示不了..."
 configParameter:^(ShowHUD *config) {
 config.margin          = 10.f;    // 边缘留白
 config.opacity         = 0.7f;    // 设定透明度
 config.cornerRadius    = 2.f;     // 设定圆角
 } duration:3 inView:self.view];
 */
+ (void)showText:(NSString *)text
 configParameter:(void(^)(ZHShowHUD *config))configShowHUDBlock
        duration:(NSTimeInterval)sec
          inView:(UIView *)view;
// 加载自定义view并持续几秒的方法
/* - 使用示例 -
 [ShowHUD showText:@"请稍后,显示不了..."
 configParameter:^(ShowHUD *config) {
 config.margin          = 10.f;    // 边缘留白
 config.opacity         = 0.7f;    // 设定透明度
 config.cornerRadius    = 2.f;     // 设定圆角
 } duration:3 inView:self.view];
 */
+ (void)showCustomView:(UIView *(^)(void))configShowHUDCustomViewBlock
       configParameter:(void(^)(ZHShowHUD *config))configShowHUDBlock
              duration:(NSTimeInterval)sec
                inView:(UIView *)view;

+ (instancetype)showTextOnly:(NSString *)text
             configParameter:(void(^)(ZHShowHUD *config))configShowHUDBlock
                      inView:(UIView *)view;

+ (instancetype)showText:(NSString *)text
         configParameter:(void(^)(ZHShowHUD *config))configShowHUDBlock
                  inView:(UIView *)view;

+ (instancetype)showCustomView:(UIView *(^)(void))configShowHUDCustomViewBlock
               configParameter:(void(^)(ZHShowHUD *config))configShowHUDBlock
                        inView:(UIView *)view;

- (void)hide;

@end
